const PI = 3.14
let b = 11
{
    let a =  123
    // console.log(b)
}
// 解构
// let obj1 = {name: 'zhang', age: 9}
// let {name:name1, age:age1} = obj1
// console.log(name1,age1)

// 模板字符串
let name = 'zf', age=9;
// let desc = `${name} 今年 ${age}岁了`
let desc = "${name} 今年 ${age}岁了"


// function replace(desc){
//     return desc.replace(/\$\{([^}]+)\}/g,function(matched, key){
//         console.log(matched, key)
//         return eval(key)
//     })
// }
// console.log(replace(desc))

let users = [{name: 'z', age: 9}, {name: 'f', age: 10}]

let newList = users.map(function(user,index){
    return `
    <li>${user.name}:${user.age}</li>`
}).join("")
// console.log(newList)

// 其他运算符 ...arguments

let str = "zfpx"
// 字符串是否以什么开始
console.log(str.startsWith("z"))  // true

let filename = 'avatar.jpg'
if(filename.endsWith('jpg') || filename.endsWith("png")){
    console.log('是一张图片')
}
// 判断一个字符串是否包含另一个字符串
let content = 'abc'
console.log(content.includes("b"))

let str5 = 'abcd'
// console.log(String.padStart('0', 10))
// 
// console.log(...[1,2,3])


